xen/arm: Set foreign page type to p2m_map_foreign
authorJulien Grall <julien.grall@linaro.org>
Tue, 17 Dec 2013 16:27:57 +0000 (16:27 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 18 Dec 2013 14:32:55 +0000 (14:32 +0000)
commit8e3079c48187aa6d04686ddb51afa10234cdbcf0
tree485b6af78eaf99da340110f3f6420cfa75267844
parent84f29a98dc31fcf4a6bbf380601f4b3651c761f8
xen/arm: Set foreign page type to p2m_map_foreign

Xen needs to know that the current page belongs to another domain. Also take
a reference to this page.

The current process to add a foreign page is:
   1) get the page from the foreign p2m
   2) take a reference on the page with the foreign domain in parameters
   3) add the page to the current domain p2m

If the foreign domain drops the page:
    - before 2), get_page will return NULL because the page doesn't
    belong anymore to the domain
    - after 2), the current domain already have a reference. Write will
    occur to an old page which is not yet released. It can corrupt the foreign
    domain.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/mm.c
xen/include/asm-arm/p2m.h